#include <stdio.h>

FILE *fp, *gp;
char buf[256];
char *s = "this is a string";

int main(int argc, char const *argv[])
{
    fp = fopen("txt1.txt", "r");
    gp = fopen("txt2.txt", "w");
    fgets(buf, 256, fp);    
    fputs(buf, gp);
    fclose(fp); fclose(gp);
    return 0;
}
